﻿using DDD.StorageMode.IRepository;
using DDD.StorageModel.Model;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Umbraco.Core.Persistence;

namespace DDD.StorageModel.Controllers.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class T1Controller : Controller
    {
        private readonly IRepository<t1,string> _repositoryService;
        public T1Controller(IRepository<t1,string> repositoryService)
        {
            _repositoryService = repositoryService;
        }
        [HttpGet("select")]
        public List<t1> select()
        {
            return _repositoryService.GetAllList();
        }
        [HttpGet("update")]
        public bool update()
        {
            t1 t1 = new t1();
            t1.id = "10";
            t1.name = "10";
            t1.test1 = "11";
            _repositoryService.Update(t1);
            return true;
        }
        [HttpGet("delect")]
        public bool delect()
        {
            t1 t1 = new t1();
            t1.id = "10";
            t1.name = "10";
            t1.test1 = "10";
            _repositoryService.Delete(t1);
            return true;
        }
        [HttpGet]
        [Route("insert")]
        public bool insert()
        {
            t1 t1 = new t1();
            t1.id = "10";
            t1.name = "10";
            t1.test1 = "10";
            _repositoryService.Insert(t1);
            return true;
        }
    }
}
